﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace Common.MQ
{
    /// <summary>
    /// 消息队列生产者接口
    /// </summary>
    public interface IMQProducer
    {
        /// <summary>
        /// 声明队列信息
        /// </summary>
        /// <param name="queue"></param>
        void Declare(IDestination queue);
        /// <summary>
        /// 发送消息
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        Task<bool> ProduceAsync(IMessageModel message);
        /// <summary>
        /// 发送消息
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="data"></param>
        /// <param name="destination"></param>
        /// <returns></returns>
        Task<bool> ProduceAsync<T>(T data, string destination);
        /// <summary>
        /// 发送消息
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="data"></param>
        /// <param name="destination">目的地（kafka: topic名称；rabbitmq: topic://exchange/#）</param>
        /// <param name="property">消息属性</param>
        /// <returns></returns>
        Task<bool> ProduceAsync<T>(T data, string destination, MessageProperty property);
    }
}
